﻿import abc

from criticalpath import Node


class Activity(Node):
    def __init__(self, name, duration=None, lag=0,
                 duration_likely=20,
                 duration_low=10, duration_high=45,
                 completion_event=None):
        super().__init__(name, duration, lag)
        self.act_type = self.__class__.__name__
        # the following statement is NOT correct, making self a string
        # Node.__init__(name, duration, lag)
        self.duration_likely = duration_likely
        self.duration_low = duration_low
        self.duration_high = duration_high
        self.completion_event = completion_event

    def __repr__(self):
        return 'act_type=' + self.act_type + ', ' \
               + 'name=' + super().__repr__() + ', ' \
               + 'dur=' + str(self.duration) + ', ' \
               + 'dur_low=' + str(self.duration_low) + ', ' \
               + 'dur_high=' + str(self.duration_high) + ', '

    @abc.abstractmethod
    def act(self):
        pass
